package com.ylyq.ylxx.quarz;

import com.ylyq.ylxx.entity.YlyqUser;
import com.ylyq.ylxx.service.IYlyqUserService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @ClassName TestTask
 * @Description TODO
 * @Author xiaweichao
 * @Date 2020/7/3 13:52
 * @Version 1.0
 */
@Slf4j
@Component
@DisallowConcurrentExecution
public class TestTask extends QuartzJobBean {
    @Autowired
    private IYlyqUserService iYlyqUserService;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info(new Date() + "任务开始------------------------------------");
        YlyqUser byId = iYlyqUserService.getById("04d16468ac80459da3d206da24483c9f");
        log.info(byId.toString());
//        LoginDTO creatAutoStopOrOpen = (LoginDTO) jobExecutionContext.getJobDetail().getJobDataMap().get("creatAutoStopOrOpen");
//        if (creatAutoStopOrOpen == null)
//            return;
//        log.info(creatAutoStopOrOpen.toString());
        log.info(new Date() + "任务结束------------------------------------");
    }
}
